<?php
/**
 * 3 News
 * 4 Health
 * 5 Beauty
 * 6 Sex
 * 7 Family
 * 8 Psycho
 * 9 Wellbeing
 * 10 Food
 * 11 Environment
 * 12 Society
 * 13 Drug
 * 
 */
$category_order_list = array (
    3 => array(22, 23, 24, 25, 26, 27, 28, 29, 30, 31),
    4 => array(33, 125, 42, 38, 35, 36, 40, 43, 126, 45),
    5 => array(167, 46, 171, 128, 132, 172, 50, 130, 129, 54, 131, 56),
    6 => array(57, 133, 134, 60, 135, 168, 173, 64, 66, 136, 68),
    7 => array(69, 137, 138, 139, 147, 140, 169, 73, 141, 75),
    8 => array(76, 77, 147, 78, 143, 79, 144, 81),
    9 => array(145, 146, 147, 83, 85, 148, 175, 86, 149, 88),
    10 => array(151, 93, 152, 90, 91, 94, 95, 153, 97),
    11 => array(154, 99, 155, 156, 102, 157, 170, 158, 109),
    12 => array(110, 159, 160, 161, 162, 111, 176, 163, 164, 115),
    13 => array(165, 117, 118, 119, 120, 121, 177, 166, 123)
);
/**
 * Sort category
 * 
 */
function hc_sort_category($cat_ID, $sub_categories) {
    global $category_order_list;
    $new_order = array();
    $cats = $category_order_list[$cat_ID];
    foreach($cats as $val) {
        foreach($sub_categories as $sc) {
            if ($val == $sc->cat_ID) {
                $new_order[] = $sc;
            }
        }
    }
    return $new_order;
}
?>
